import 'package:permission_handler/permission_handler.dart';

class PermissionHandle {
  static Future<bool> get cameraPermission async {
    var status = await Permission.camera.status;
    if (status.isDenied) {
      print('拒绝相机访问');
      return false;
    } else {
      print('允许访问相机');
      return true;
    }
  }

  static Future<bool> get micPhonePermission async {
    var status = await Permission.microphone.status;
    if (status.isDenied) {
      print('拒绝麦克风访问');
      return false;
    } else {
      print('允许麦克风相机');
      return true;
    }
  }

  static Future<bool> requestCamera() async {
    return await Permission.camera.request().isGranted;
  }

  static Future<bool> requestMicPhone() async {
    return await Permission.microphone.request().isGranted;
  }

  static requestLocation() async {}

  static openAppSetting() {
    openAppSettings();
  }
}
